package com.cjj.particle;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;

import com.plattysoft.leonids.ParticleSystem;
import com.plattysoft.leonids.modifiers.ScaleModifier;

/**
 * star particle
 * Created by cjj on 2015/7/4.
 */
public class JJStar extends ParticleSystem {

    public JJStar(Activity a,int drawableRedId) {
        super(a, 100, drawableRedId, 1000);
    }

    public JJStar(Activity a, int maxParticles, int drawableRedId, long timeToLive) {
        super(a, maxParticles, drawableRedId, timeToLive);
    }

    public JJStar(Activity a, int maxParticles, int drawableRedId, long timeToLive, int parentViewId) {
        super(a, maxParticles, drawableRedId, timeToLive, parentViewId);
    }

    public JJStar(Activity a, int maxParticles, Drawable drawable, long timeToLive) {
        super(a, maxParticles, drawable, timeToLive);
    }

    public JJStar(Activity a, int maxParticles, Bitmap bitmap, long timeToLive) {
        super(a, maxParticles, bitmap, timeToLive);
    }

    public JJStar(Activity a, int maxParticles, AnimationDrawable animation, long timeToLive) {
        super(a, maxParticles, animation, timeToLive);
    }

    /**
     * sample star
     */
    public void getSampleStar(View v,int num)
    {
        /**0 - 360作为角范围*/
        this.setSpeedRange(0.1f, 0.25f);
        this.oneShot(v,num);
    }

    /**
     * star aplhaChange
     */
    public void getAplhaStar(View v, int num)
    {
        this.setSpeedByComponentsRange(-0.1f, 0.1f, -0.1f, 0.02f);
        this.setAcceleration(0.000003f, 90);
        this.setInitialRotationRange(0, 360);
        this.setRotationSpeed(120);
        this.setFadeOut(2000);
        this.addModifier(new ScaleModifier(0f, 1.5f, 0, 1500));
        this.oneShot(v, num);
    }


}
